const svgCaptcha = require('svg-captcha');
const express= require('express');

let router = express.Router();
module.exports = router;

router.get('/',(req,res)=>{
    var codeConfig = {
        size: 4,// 验证码长度
        ignoreChars: '0o1i', // 验证码字符中排除 0o1i
        noise: 3, // 干扰线条的数量
        height: 40,
        width: 96 
    }
    var captcha = svgCaptcha.create(codeConfig);
    req.session['car_captcha'] = captcha.text.toLowerCase(); //存session用于验证接口获取文字码
    var codeData = {
        img:captcha.data
    }
    res.send(captcha.data);
})